<template>
  <a-modal
    ok-text="确认"
    cancel-text="取消"
    :maskClosable="false"
    centered
    :title="title"
    :visible="visible"
    :destroyOnClose="true"
    footer=""
    @cancel="handCancel"
  >
    <div id="meQrcode" :title="label">
      <vue-qr
        :text="text"
        :size="300"
        :margin="0"
        colorDark="black"
        colorLight="white"
      ></vue-qr>
      <div class="labelBox" v-for="(item, index) in list" :key="index">
        {{ item }}
      </div>
    </div>
    <div class="modal-footer">
      <a-button type="primary" @click="savePoster('meQrcode', title)"
        >下载</a-button
      >
      <a-button @click="handCancel">取消</a-button>
    </div>
  </a-modal>
</template>
<script>
import VueQr from "vue-qr";
import { savePoster } from "@/unit/tool";
export default {
  props: {
    //二维码底部文字
    label: {
      default: "",
    },
    //logo尺寸（正方形 长宽相同）
    text: {
      default: "",
    },
  },
  components: { VueQr },
  data() {
    return {
      title: "",
      visible: false,
      list: [],
    };
  },
  methods: {
    savePoster,
    showModal() {
      this.visible = true;
    },
    handCancel() {
      this.visible = false;
    },
  },
};
</script>
<style scoped lang="less">
.qrcode_box,
#meQrcode {
  display: inline-block;
  padding: 10px 10px 0 10px;
}

.qrcode_box img {
  display: none;
}

.modal-footer {
  text-align: center;
  margin: 20px 0 0 0;
  button {
    margin: 0 20px;
  }
}
::v-deep .ant-modal-body {
  text-align: center !important;
}
.labelBox {
  text-align: center;
  font-size: 20px;
  margin: 5px 0;
}
</style>
